list1 = [42,18,73,5,91,26,34,88,88,12,67,55,3,79,14,82,49,6,95,22,51,38,7,63,29,85,16,58,31,77,10]
# def getorder(ls): #有缺陷，存在多余的循环和比较操作，效率较低。
#     for i in list1:
#         for n in range(0,len(ls)-1):
#             if ls[n] > ls[n+1]:
#                 ls[n],ls[n+1]= ls[n+1],ls[n]
#     print(ls)
# print(getorder(list1))
def getorder(ls):
    for i in range(0,len(ls)-1):  # 循环几轮
        for j in range(0,len(ls)-i-1):  # 每一轮的操作 两两进行比较
            #比较
            if ls[j]>ls[j+1]:
                # 互换
                ls[j],ls[j+1] = ls[j+1],ls[j]
    print(ls)